//
//  PSNamedLinkedElement.m
//  PrefCore
//
//  Created by Sergey on 5/8/14.
//  Copyright (c) 2014 Play-on-smart. All rights reserved.
//

#import "PSNamedLinkedElement.h"
#import <libkern/OSAtomic.h>

static int32_t totalCount = 0;

@implementation PSNamedLinkedElement

-(instancetype)initWithName:(NSString*)name {
    if (self = [super init]) {
        _name = name;
        OSAtomicIncrement32(&totalCount);
    }
    return self;
}

+(instancetype)entryWithName:(NSString *)name {
    return [[PSNamedLinkedElement alloc] initWithName:name];
}

-(void)dealloc {
    OSAtomicDecrement32(&totalCount);
}

-(NSString*)description {
    return _name;
}

+(uint32_t)totalCount {
    return totalCount;
}

@end
